/*--------------------------------------------------------------------------------*/
#ifndef __TABLE__
#define __TABLE__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "cstdlib"
/*--------------------------------------------------------------------------------*/
template< typename _CLASS_, COUNT _ITEM_COUNT_ >
class TABLE
{

public:

    // .. TYPES


    // .. CONSTRUCTORS

    TABLE()
    {
    }

    // .. METHODS

    VOID Clear()
    {
    	memset( &Table, 0, sizeof( _CLASS_ ) * _ITEM_COUNT_ );
    }

    VOID Set( const INDEX index, const _CLASS_ & item )
    {
        Table[ index ] = item;
    }

    COUNT GetItemCount() const
    {
        return _ITEM_COUNT_;
    }

    const _CLASS_ *GetArray() const
    {
    	return &Table[0];
    }

    _CLASS_ *GetArray()
    {
    	return &Table[0];
    }

    // .. OPERATORS

    _CLASS_ & operator[]( const INDEX item_index )
    {
        return Table[ item_index ];
    }

    const _CLASS_ & operator[]( const INDEX item_index ) const
    {
        return Table[ item_index ];
    }

    _CLASS_ & operator=( const _CLASS_ & other )
    {
    	INDEX
			i;

    	for_each_index( i, _ITEM_COUNT_ )
    	{
    		Table[ i ] = other.Table[ i ];
    	}
    }




private:

    // .. ATTRIBUTES

    _CLASS_ Table[ _ITEM_COUNT_ ];

};
/*--------------------------------------------------------------------------------*/
#endif



